using System;
using System.Collections;
using System.Collections.Generic;
using Script.My_Gameplay_Ability_System.Attributes.Base;
using UnityEngine;

namespace Script.My_Gameplay_Ability_System.Attributes.Components
{
    [Serializable]
    public struct AttributeValue
    {
        /// <summary>
        /// 基础属性类型（如"攻击力"或"生命值"）
        /// </summary>
        public AttributeBase Attribute { get; set; }
        
        /// <summary>
        /// 属性的初始值（如角色初始攻击力为10）
        /// </summary>
        public float BaseValue { get; set; }
        
        /// <summary>
        /// 经过所有修正（Modifier）计算后的实际值（如装备+2、Buff+3 → 当前值=15）
        /// </summary>
        public float CurrentValue { get; set; }
        
        /// <summary>
        /// 存储当前应用的数值修正（加法、乘法、覆盖）
        /// </summary>
        public AttributeModifier Modifier { get; set; }
    }
    
    [Serializable]
    public struct AttributeModifier
    {
        /// <summary>
        /// 加法修正
        /// </summary>
        public float Add { get; set; }

        /// <summary>
        /// 乘法修正（百分比）
        /// </summary>
        public float Multiply { get; set; }
        
        /// <summary>
        /// 覆盖修正（强制设置值）
        /// </summary>
        public float Override { get; set; }
        
        /// <summary>
        /// 合并两个修正值（用于叠加多个Buff效果）
        /// </summary>
        /// <param name="other">其他修正值</param>
        /// <returns></returns>
        public AttributeModifier Combine(AttributeModifier other)
        {
            other.Add += Add;
            other.Multiply += Multiply;
            other.Override = Override;
            return other;
        }
    }
}

